package main

import (
	"fmt"
	"time"
)

func fibRecursive(n int) int {
	if n <= 1 {
		return n
	}
	return fibRecursive(n-1) + fibRecursive(n-2)
}

func fibIterative(n int) int {
	if n <= 1 {
		return n
	}
	a, b := 0, 1
	for i := 2; i <= n; i++ {
		a, b = b, a+b
	}
	return b
}

func main() {
	startRecursive := time.Now()
	fmt.Println("Golang Recursive Fibonacci(30):", fibRecursive(30))
	elapsedRecursive := time.Since(startRecursive)
	fmt.Printf("Recursive Execution time: %v\n", elapsedRecursive)

	startIterative := time.Now()
	fmt.Println("Golang Iterative Fibonacci(30):", fibIterative(30))
	elapsedIterative := time.Since(startIterative)
	fmt.Printf("Iterative Execution time: %v\n", elapsedIterative)
}